package lambda.string;

public class EqualsDemo {
    public static void main(String[] args) {
        String s1="hello";
        String s2="hello";//重用对象
        System.out.println("s1"+s1);
        System.out.println("s2"+s2);
        System.out.println(s1==s2);//true
        String s3=new String("hello");
        System.out.println("s3"+s3);
        System.out.println(s1==s2);//false
        System.out.println(s1.equals(s3));

        String code="123AbFd";
        String input="123abfd";
        System.out.println("验证:"+code.equals(input));
        //转换为大写在进行验证
        code =code.toUpperCase();
        input=input.toUpperCase();
        System.out.println("验证:"+code.equals(input));
        //忽略大小写进行验证
        System.out.println("验证:"+code.equalsIgnoreCase(input));
    }
}
